using System;
using System.Collections.Specialized;


namespace widgets.TwitterFeed {
  public partial class WidgetsTwitterFeedEdit : WidgetEditBase
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      StringDictionary settings = GetSettings();
      if ( !settings.ContainsKey( "username" ) )
        return;
      this.txtUsername.Text = settings["username"];
      this.txtTwits.Text = settings["maxitems"];
      this.chkRepl.Checked = Convert.ToBoolean(settings["showreplies"]);
      this.txtUserpage.Text = settings["userpage"];
      this.txtPicname.Text = settings["picname"];
      this.chkUsr.Checked = Convert.ToBoolean( settings["linkusernames"] );
    }

    public override void Save()
    {
      StringDictionary settings = GetSettings();		
      settings["username"] = this.txtUsername.Text;
      settings["maxitems"] = this.txtTwits.Text;
      settings["showreplies"] = this.chkRepl.Checked.ToString();
      settings["userpage"] = this.txtUserpage.Text;
      settings["picname"] = this.txtPicname.Text;
      settings["linkusernames"] = this.chkUsr.Checked.ToString();
      SaveSettings( settings );
    }
  }
}